<template>
  <div class=''>
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="都被你看光了"
      @load="onLoad"
      :offset="30"
    >
      <van-cell v-for="item in newsList" :key="item.id" :title="item.name" />
    </van-list>
  </div>
</template>
<script>
export default {
  data() {
    return {
      newsList: [],
      loading: false,
      finished: false,
      page: 0
    };
  },
  methods: {
    onLoad() {
      let _this = this
      // 请求分页参数
      _this.page = _this.page + 1
      console.log(_this.page)
      let msg = { // 
        type:1 // 请求类型参数
      }
      // 发送axios请求，合并数据
      _this.$api.sumrue.newsListPageGet(msg).then(
        res => {
          _this.newsList = _this.newsList.concat(res) // 组合数组
          console.log(_this.newsList)
          _this.loading = false
          // 当数据量不足，即无数据时结束请求，展示无内容信息
          if(res.length  < 10) {
            _this.finished = true
            
          }
        }
      )
    },
  },
};
</script>

<style scoped>
</style>
